package com.mathdroid.crawler.shared;


import java.awt.Color;
import java.util.LinkedList;

/**
 * The rarity of an item. Each rarity has a unique color.
 */
public enum ERarity {
	/**
	 * Cheap items.
	 */
	CHEAP("Cheap", new Color(143, 143, 143)),
	/**
	 * Standard items.
	 */
	STANDARD("Standard", new Color(255, 255, 255)),
	/**
	 * Premium items.
	 */
	PREMIUM("Premium", new Color(0, 150, 0)),
	/**
	 * Prototype items.
	 */
	PROTOTYPE("Prototype", new Color(29, 138, 250)),
	/**
	 * Artifact items.
	 */
	ARTIFACT("Artifact", new Color(163, 53, 238)),
	/**
	 * Legendary items.
	 */
	LEGENDARY("Legendary", new Color(255, 128, 0)),
	/**
	 * Legacy items.
	 */
	LEGACY("Legacy", new Color(229, 204, 128));
	
	/**
	 * The color of the rarity.
	 */
	private Color color = null;
	
	/**
	 * The name of the rarity.
	 */
	private String name = null;
	
	/**
	 * Create a new rarity.
	 * @param n Name.
	 * @param c Color.
	 */
	ERarity(final String n, final Color c) {
		this.name = n;
		this.color = c;
	}
	
	@Override
	public final String toString() {
		return this.name;
	}
	
	/**
	 * Get the color of the rarity.
	 * @return Color.
	 */
	public final Color getColor() {
		return this.color;
	}

	/**
	 * Get all available rarities as a list. This list is ordered from cheap
	 * to legacy.
	 * @return All rarities.
	 */
	public static LinkedList<ERarity> getAllRarities() {
		LinkedList<ERarity> r = new LinkedList<ERarity>();
		
		r.add(CHEAP);
		r.add(STANDARD);
		r.add(PREMIUM);
		r.add(PROTOTYPE);
		r.add(ARTIFACT);
		r.add(LEGENDARY);
		r.add(LEGACY);
		
		return r;
	}
}
